home *** CD-ROM | disk | FTP | other *** search
- property rightLoc, leftLoc, numStops, vertical, snapLocs, notchLength
- global gMachineData
-
- on mouseDown me
- set vNewLocH to getAt(the snapLocs of me, the currSndVolume of gMachineData + 1)
- repeat while the mouseDown
- set vSlideLoc to the mouseH
- case 1 of
- (vSlideLoc < the leftLoc of me):
- set the loc of sprite the spriteNum of me to point(the leftLoc of me, the vertical of me)
- set vNewLocH to the leftLoc of me
- (vSlideLoc > the rightLoc of me):
- set the loc of sprite the spriteNum of me to point(the rightLoc of me, the vertical of me)
- set vNewLocH to the rightLoc of me
- otherwise:
- set the loc of sprite the spriteNum of me to point(the mouseH, the vertical of me)
- set vNewLocH to vSlideLoc
- end case
- updateStage()
- end repeat
- set vNewNotch to integer((vNewLocH - the leftLoc of me) / the notchLength of me) + 1
- newSnap(me, vNewNotch)
- setVolume(gMachineData, vNewNotch - 1)
- end
-
- on newSnap me, thisNotch
- set snapPointH to getAt(the snapLocs of me, thisNotch)
- set the loc of sprite the spriteNum of me to point(snapPointH, the vertical of me)
- updateStage()
- end
-
- on beginSprite me
- set the notchLength of me to 1.0 * (the rightLoc of me - the leftLoc of me) / (the numStops of me - 1)
- set vStopsList to []
- sort(vStopsList)
- add(vStopsList, the leftLoc of me)
- add(vStopsList, the rightLoc of me)
- repeat with X = 1 to the numStops of me - 2
- add(vStopsList, integer(X * the notchLength of me) + the leftLoc of me)
- end repeat
- set the snapLocs of me to vStopsList
- set vLevel to the currSndVolume of gMachineData + 1
- set the vertical of me to the locV of sprite the spriteNum of me
- set the loc of sprite the spriteNum of me to point(getAt(the snapLocs of me, vLevel), the vertical of me)
- end
-
- on getPropertyDescriptionList
- set myProps to [#leftLoc: [#comment: "Left location (smaller number):", #format: #integer, #default: 0], #rightLoc: [#comment: "Right location (bigger number):", #format: #integer, #default: 640], #numStops: [#comment: "Number of snap-to positions:", #format: #integer, #default: 0]]
- return myProps
- end
-
- on getBehaviorDescription
- return "A horizontal slider with a series of stop points. Left is lowest, right is highest. Controls/communicates with two objects (globals)."
- end
-